# 检查cmake的最低版本
cmake_minimum_required(VERSION 3.10.0)
# 定义工程名称
project(Leste)
# 定义使用的c++标准
set(CMAKE_CXX_STANDARD 11)

# 添加头文件
set(INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extern/include)
include_directories(
        ${INCLUDE_DIR}
        ${CMAKE_SOURCE_DIR}/src
        ${CMAKE_SOURCE_DIR}/src/gameobject
        ${CMAKE_SOURCE_DIR}/src/behaviour
        ${CMAKE_SOURCE_DIR}/src/camera
        ${CMAKE_SOURCE_DIR}/src/window
        ${CMAKE_SOURCE_DIR}/src/gui
        ${CMAKE_SOURCE_DIR}/src/physics
        ${CMAKE_SOURCE_DIR}/src/render
        ${CMAKE_SOURCE_DIR}/src/transform
        ${CMAKE_SOURCE_DIR}/src/utils
        ${CMAKE_SOURCE_DIR}/src/particlesystem
        ${CMAKE_SOURCE_DIR}/src/postprocessing
        ${CMAKE_SOURCE_DIR}/src/script
        ${CMAKE_SOURCE_DIR}/src/script/cube
        ${CMAKE_SOURCE_DIR}/src/script/lightcube
        ${CMAKE_SOURCE_DIR}/src/script/background
        ${CMAKE_SOURCE_DIR}/src/script/ground
        ${CMAKE_SOURCE_DIR}/src/script/quad
        ${CMAKE_SOURCE_DIR}/src/script/player
        ${CMAKE_SOURCE_DIR}/src/script/cubicbox
        ${CMAKE_SOURCE_DIR}/src/script/fire
        ${CMAKE_SOURCE_DIR}/src/script/firework
)

# 添加目标链接
set(LIB_DIR ${CMAKE_SOURCE_DIR}/extern/lib)
link_directories(
        ${LIB_DIR}
)

#收集文件
file(GLOB_RECURSE SOURCES ${CMAKE_SOURCE_DIR}/src/*.cpp)
file(GLOB_RECURSE HEADERS ${CMAKE_SOURCE_DIR}/src/*.h)

#生成可执行程序
add_executable(${PROJECT_NAME}
        ${HEADERS}
        ${SOURCES}
        ${CMAKE_SOURCE_DIR}/extern/glad.c
        )

#此处添加依赖库
target_link_libraries(${PROJECT_NAME}
        glfw3
        box2d
        )

# mac下需添加以下frameworks
if (APPLE)
    target_link_libraries(${PROJECT_NAME} "-framework OpenGL")
    target_link_libraries(${PROJECT_NAME} "-framework Cocoa")
    target_link_libraries(${PROJECT_NAME} "-framework IOKit")
endif()
